<!--
 * @Description: combos -- 课程
 * @Author: your name
 * @Date: 2024-03-07
 * @LastEditTime: 2024-03-07
 * @LastEditors: Please set LastEditors
-->

<template>
  <div>
    <div class="combos heart_w">
      <el-breadcrumb separator-class="el-icon-arrow-right">
        <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item><a href="/">活动管理</a></el-breadcrumb-item>
        <el-breadcrumb-item>活动列表</el-breadcrumb-item>
      </el-breadcrumb>

      <div class="question_choose">
        <div class="question_ku">
          <h1>图书商城</h1>
          <div class="select2">
            <ul>
              <p>分类：</p>
              <li
                v-for="(item, i) in tabsList"
                :key="item.id"
                :class="{ li_active: li_active == i }"
                @click="bookIfication(item, i)"
              >
                {{ item.name }}
              </li>
            </ul>
          </div>

          <!-- 按时间按人气 -->
          <div class="time_moods">
            <div>
              <a
                data-sort="sort"
                href="javascript:;"
                :class="{ tm_active: !tm_active }"
                @click="popularityTime"
              >
                <img
                  src="https://www.rongyuejiaoyu.com/static/index/images/fire.png"
                  alt=""
                  class="fire"
                />
                按人气
              </a>
              <a
                href="javascript:;"
                :class="{ tm_active: tm_active }"
                @click="popularityTime"
              >
                <img
                  src="https://www.rongyuejiaoyu.com/static/index/images/clock.png"
                  alt=""
                  class="clock"
                />
                按时间
              </a>
            </div>
            <!-- <div class="right_img">
              <img
                src="https://www.rongyuejiaoyu.com/static/index/images/kuaired.png"
                alt=""
                class="kuaired"
              />
              <img
                src="https://www.rongyuejiaoyu.com/static/index/images/liegray.png"
                alt=""
                class="liegray"
              />
            </div> -->
          </div>
        </div>
      </div>

      <!-- 块状布局+列状布局 wow slideInLeft -->
      <div class="block_flex" id="ToggleClass" v-show="!block_column">
        <ul>
          <li
            v-for="item_li in booksObj"
            :key="item_li.id"
            data-wow-delay="0.5s"
            class="item wow animate__animated animate__bounceInRight animated"
          >
            <a href="javascript:void(0);">
              <el-image
                lazy
                src="https://video.rycfa.com/image/default/976897EBCD504A09BA391BF25BFB4E95-6-2.jpg"
              >
              </el-image>
              <div class="block_info">
                <p class="ptitle">{{ item_li.title }}</p>
                <p class="pmoney">
                  <small>￥{{ item_li.price }}</small>
                </p>
              </div>
            </a>
          </li>
        </ul>
      </div>
      <!-- 列状布局 -->
      <div class="column_info" v-show="block_column">
        <div class="box_info">
          <div class="lesson_img">
            <a href="#" target="_blank">
              <img
                src="https://video.rycfa.com/image/default/34CCE1ACBFF3442DBBC3A34E94D2565A-6-2.jpg"
                alt=""
              />
            </a>
          </div>
          <div class="ci_left">
            <h6>
              <a href="#" title="CFA快速通关APS智播课" target="_blank">
                CFA快速通关APS智播课
              </a>
            </h6>
            <p class="cfalabel">CFA&nbsp;Level I</p>
            <p>
              有效期：<b>购课之日起至2024年12月01日</b> &nbsp;|&nbsp; 视频：
              <b> 0个 </b>
            </p>
            <p class="shiying">
              适应人群：
              <b>
                CFA智能题库，1.精选习题：名师精选题目，涵盖CFA考试疑难、易错、高频等多种题型；2.双重模式：做题模式，按章节知识点有序练习；背题模式，对照解析，开卷做题。3.双重解析：题目配有文字解析+视频解析。4.智能组卷：可随机智能组卷，模拟考试。5.强大功能：错题收录、收藏收录，多种设备同步记忆，助你高效备考。
              </b>
            </p>
            <p>
              特色服务：
              <a href="javascript:;">殿堂级师资</a>
            </p>
          </div>
          <div class="ci_right">
            <p>25980.00</p>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { getBookList, getComboList } from '@/api/cmobos.js'
export default {
  name: 'combos',
  data() {
    return {
      tm_active: false,
      block_column: false,
      li_active: 0,
      tabsList: [],
      booksObj: [],
      tabId: 1
    }
  },
  created() {},
  mounted() {
    this.getList()
    this.getcombosData()
    this.obtainingBooks()
  },
  methods: {
    popularityTime() {
      this.tm_active = !this.tm_active
    },
    async getcombosData() {
      const { data: data } = await getComboList()
      this.tabsList = data.data
    },
    async obtainingBooks() {
      const { data: data } = await getBookList({ cate: this.tabId })
      this.booksObj = data.data
    },
    bookIfication(it, i) {
      this.li_active = i
      this.tabId = it.id
      this.obtainingBooks()
    },
    getList() {
      this.$nextTick(() => {
        new this.$wow.WOW().init()
      })
    }
  }
}
</script>

<style scoped lang="scss">
.combos {
  .el-breadcrumb {
    height: 40px;
    line-height: 40px;
    font-size: 15px;
    color: #444;
    background-color: #fff;
    padding: 12px 8px;
    margin: 14px 0;
    border-radius: 3px;
  }
}

.block_flex {
  ul {
    list-style: none;
    display: flex;
    align-items: center;
    flex-wrap: wrap;

    li {
      border-radius: 5px;
      box-shadow: -5px 5px 10px -5px #f1f1f1, 5px 5px 10px -5px #f1f1f1;
      transition: 0.5s all ease;
      margin-right: 32px;
      margin-bottom: 20px;
      background: #fff;
      box-sizing: border-box;
      width: 276px;
      height: 270px;

      &:hover {
        transform: translateY(-15px);
        transition: 0.5s all ease;
      }

      a {
        height: 100%;
        display: block;
      }
    }

    li:nth-child(4n) {
      margin-right: 0;
    }

    a {
      .el-image {
        width: 276px;
        height: 179px;
        border-top-left-radius: 5px;
        border-top-right-radius: 5px;
      }

      .block_info {
        p {
          padding: 0 5px;
        }
        .ptitle {
          font-size: 16px;
          color: #333;
          margin-top: 10px;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }

        .pmoney {
          overflow: hidden;
          margin-top: 10px;

          small {
            color: #ff434b;
            font-size: 20px;
            float: left;
          }
        }
      }
    }
  }
}

.question_choose {
  margin-bottom: 15px;
}
.question_ku {
  border-radius: 5px;
  padding: 15px;
  box-shadow: 0 0 20px #f1f1f1;
  background-color: #fff;

  h1 {
    text-align: center;
    height: 53px;
    line-height: 53px;
    font-size: 22px;
    font-weight: 500;
  }

  .select2 {
    ul {
      display: flex;
      align-items: center;
      border-bottom: 1px solid #eaeaea;
      line-height: 42px;
      list-style: none;
      flex-wrap: wrap;

      .li_active {
        color: #bd0000;
      }

      p {
        text-indent: 24px;
        color: #333333;
        font-size: 14px;
        margin-right: 15px;
        font-weight: bold;
      }

      li {
        cursor: pointer;
        margin-right: 30px;
        font-weight: bold;
      }
    }
  }

  .time_moods {
    width: 1162px;
    height: 46px;
    line-height: 46px;
    margin: 19px 0 0 0;
    background: #f3f5f7;
    border-radius: 2px;
    padding: 0 12px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;

    .tm_active {
      background-color: #bd0000 !important;
    }

    .right_img {
      img {
        vertical-align: middle;
        margin-right: 15px;
        cursor: pointer;
      }
    }

    a {
      width: 98px;
      height: 30px;
      line-height: 30px;
      display: inline-block;
      margin-left: 20px;
      background: #ccc;
      border-radius: 5px;
      color: #fff;
      font-size: 14px;
      text-indent: 16px;
    }
  }
}

/* // 列装布局 */

.column_info {
  margin-bottom: 25px;
  padding: 0 20px;
  background: #fff;

  .box_info {
    justify-content: space-between;
    display: flex;
    border-bottom: 1px dashed #e5e5e5;
    padding: 20px 0;
    align-items: center;
  }

  .box_info:last-child {
    border: none;
  }

  .lesson_img {
    width: 276px;
    height: 180px;

    a {
      img {
        width: 100%;
        height: 100%;
      }
    }
  }

  .ci_left {
    margin-left: 28px;
    flex: 3;

    .shiying {
      font-size: 14px;
      color: #999;
      margin-top: 12px;

      b {
        font-weight: normal;
        color: #333;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
      }
    }

    .cfalabel {
      width: 100px;
      height: 22px;
      line-height: 22px;
      color: #fff;
      background: #bd0000;
      text-align: center;
      margin-top: 13px;
      font-size: 15px;

      & + p {
        font-size: 14px;
        color: #999;
        margin-top: 15px;

        b {
          font-weight: normal;
          color: #333;
        }
      }
    }

    p:last-child {
      margin-top: 15px;
      font-size: 14px;
      color: #999;

      a {
        display: inline-block;
        height: 24px;
        line-height: 24px;
        padding: 0 12px;
        background: #fff0f0;
        color: #bd0000;
        border-radius: 3px;
        margin-right: 16px;
        margin-bottom: 10px;
      }
    }
    h6 {
      font-size: 16px;
      font-weight: bold;
      color: #333;
      margin-top: 10px;
      a {
        color: #333;
        text-decoration: none;
      }
    }
  }

  .ci_right {
    flex: 1;
    height: 126px;
    border-left: 1px solid #e5e5e5;
    width: 250px;
    // margin-top: 27px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;

    p {
      color: #ff434b;
      font-size: 22px;
    }
  }
}
</style>
